package cn.edu.fzu.homemaking.sso.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.*;

import cn.edu.fzu.homemaking.io.DingDingMessage;
import cn.edu.fzu.homemaking.io.OgReq;
import cn.edu.fzu.homemaking.sso.service.DingDingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api(tags = "钉钉机器人")
@RequestMapping("/api/")
@RestController
public class DingDingController {

    @Resource
    private DingDingService dingDingService;

    @ApiOperation(value = "钉钉机器人回调接口（前端请勿调用）")
    @PostMapping("/ding")
    public DingDingMessage query(@RequestBody OgReq req, @RequestHeader("timestamp") String timestamp,
                                 @RequestHeader("sign") String sign) {
        return dingDingService.query(req, timestamp, sign);
    }
}
